package com.tt.task;

import lombok.Data;

import java.util.Objects;

/**
 * @Title: ScheduledFutureHolder
 * @Author zl
 * @Package com.oberyun.zhgc.datascreen.config
 * @Date 2025/7/29 9:23
 * @description: 定时任务包装类
 */

@Data
public class MethodTaskInfo {
    /**
     * 方法所属对象实例
     */
    private Object target;
    /**
     * 方法名
     */
    private String methodName;
    /**
     * 参数类型数组
     */
    private Class<?>[] paramTypes = new Class[0];
    /**
     * 参数值数组
     */
    private Object[] args = new Object[0];

    public MethodTaskInfo(Object target, String methodName) {
        this.target = target;
        this.methodName = methodName;
    }

    public MethodTaskInfo(Object target, String methodName, Object[] args) {
        this.target = target;
        this.methodName = methodName;
        this.args = args;
        if (Objects.nonNull(args)) {
            this.paramTypes = new Class[args.length];
            for (int i = 0; i < args.length; i++) {
                paramTypes[i] = args[i].getClass();
            }
        }
    }
}
